package com.cnostar.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ScheduledThreadPoolExecutor;

/**
 * 配置线程池，执行定时任务时，不会因一个定时任务执行时间长卡住
 * @Date 2020/3/24 18:54
 * @Author ZhuFeng
 * @Version 2.0
 */
@Configuration
public class ThreadConfig {

    @Bean
    public ScheduledThreadPoolExecutor scheduledExecutorService() {
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10);
        return executor;
    }

}
